package com.woniuxy.service.impl;

import com.woniuxy.pojo.Account;
import com.woniuxy.service.AccountService;
import com.woniuxy.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PayServiceImpl implements PayService {
    @Autowired
    private AccountService accountService;
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void pay(Account account1,Account account2) {
        this.accountService.addAccount(account1);
        System.out.println("*************************");
        this.accountService.updateAccount(account2);
    }
}
